VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{B3FB64BF-91F9-11D7-A482-0008A14158BC}#2.22#0"; "ITGControls.ocx"
Begin VB.Form frmBasicGLIntAR 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   7590
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   10425
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   7590
   ScaleWidth      =   10425
   ShowInTaskbar   =   0   'False
   Begin MSComctlLib.StatusBar sbRS 
      Align           =   2  'Align Bottom
      Height          =   285
      Left            =   0
      TabIndex        =   0
      Top             =   7305
      Width           =   10425
      _ExtentX        =   18389
      _ExtentY        =   503
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   5
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Bevel           =   0
            Object.Width           =   5161
            MinWidth        =   2
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
            Text            =   "Transaction Status"
            TextSave        =   "Transaction Status"
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin ITGControls.ITGTab SSTab2 
      Height          =   4410
      Left            =   30
      TabIndex        =   4
      Top             =   30
      Width           =   8850
      _ExtentX        =   15610
      _ExtentY        =   7779
      TabCount        =   2
      TabCaption(0)   =   "               Main               "
      TabContCtrlCnt(0)=   1
      Tab(0)ContCtrlCap(1)=   "ComunionFrames1"
      TabCaption(1)   =   "               List               "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "dtgList"
      TabTheme        =   2
      ActiveTabBackStartColor=   16250865
      ActiveTabBackEndColor=   16243138
      InActiveTabBackStartColor=   16243138
      InActiveTabBackEndColor=   16243138
      InActiveTabForeColor=   0
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   4210752
      TopLeftInnerBorderColor=   4210752
      BottomRightInnerBorderColor=   4210752
      DisabledTabBackColor=   16243138
      DisabledTabForeColor=   -2147483630
      Begin MSDataGridLib.DataGrid dtgList 
         Height          =   2730
         Left            =   -75000
         TabIndex        =   11
         Top             =   315
         Width           =   8850
         _ExtentX        =   15610
         _ExtentY        =   4815
         _Version        =   393216
         AllowUpdate     =   0   'False
         AllowArrows     =   -1  'True
         Appearance      =   0
         HeadLines       =   1
         RowHeight       =   15
         TabAcrossSplits =   -1  'True
         TabAction       =   2
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   6
         BeginProperty Column00 
            DataField       =   "cTranNo"
            Caption         =   "Receipt No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "dDate"
            Caption         =   "Date"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   3
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cReceived"
            Caption         =   "Received From"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "nCheck"
            Caption         =   "Total Check"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "nCash"
            Caption         =   "Total Cash"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   "nAmount"
            Caption         =   "Total Amount"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            AllowRowSizing  =   0   'False
            BeginProperty Column00 
               Locked          =   -1  'True
               ColumnWidth     =   1200.189
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
               ColumnWidth     =   1170.142
            EndProperty
            BeginProperty Column02 
               Locked          =   -1  'True
               ColumnWidth     =   1560.189
            EndProperty
            BeginProperty Column03 
               Alignment       =   1
               Locked          =   -1  'True
               ColumnWidth     =   1425.26
            EndProperty
            BeginProperty Column04 
               Alignment       =   1
               Locked          =   -1  'True
               ColumnWidth     =   1409.953
            EndProperty
            BeginProperty Column05 
               Alignment       =   1
               Locked          =   -1  'True
               ColumnWidth     =   1409.953
            EndProperty
         EndProperty
      End
      Begin ITGControls.ComunionFrames ComunionFrames1 
         Height          =   4095
         Left            =   0
         Top             =   315
         Width           =   8850
         _ExtentX        =   15610
         _ExtentY        =   7223
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Acknowledgement Receipt Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.CommandButton cmdPickWork 
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   2550
            MousePointer    =   1  'Arrow
            Picture         =   "frmBasicGLIntAR.frx":0000
            Style           =   1  'Graphical
            TabIndex        =   29
            Top             =   1560
            Width           =   315
         End
         Begin VB.CommandButton cmdPickProject 
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   2550
            Picture         =   "frmBasicGLIntAR.frx":014A
            Style           =   1  'Graphical
            TabIndex        =   26
            Top             =   1200
            Width           =   315
         End
         Begin VB.ComboBox cboDocType 
            Appearance      =   0  'Flat
            BackColor       =   &H00FFFFFF&
            Height          =   315
            ItemData        =   "frmBasicGLIntAR.frx":0294
            Left            =   7065
            List            =   "frmBasicGLIntAR.frx":0296
            Style           =   2  'Dropdown List
            TabIndex        =   23
            Top             =   2520
            Width           =   1485
         End
         Begin VB.CommandButton cmdPickCode 
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   2550
            Picture         =   "frmBasicGLIntAR.frx":0298
            Style           =   1  'Graphical
            TabIndex        =   19
            Top             =   870
            Width           =   315
         End
         Begin VB.Timer Timer1 
            Interval        =   300
            Left            =   2610
            Top             =   405
         End
         Begin ITGControls.ITGDateBox dtbDate 
            Height          =   285
            Left            =   7035
            TabIndex        =   2
            Tag             =   "Receipt Date"
            Top             =   555
            Width           =   1500
            _ExtentX        =   2646
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
            Mandatory       =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtTranNo 
            Height          =   285
            Left            =   165
            TabIndex        =   1
            Top             =   555
            Width           =   2550
            _ExtentX        =   4286
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Receipt No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1160
            TextBoxWidth    =   1330
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtAddress 
            Height          =   285
            Left            =   165
            TabIndex        =   3
            Top             =   1905
            Width           =   8385
            _ExtentX        =   14579
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Address"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1160
            TextBoxWidth    =   7165
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtCash 
            Height          =   285
            Left            =   165
            TabIndex        =   5
            TabStop         =   0   'False
            Top             =   2865
            Width           =   2550
            _ExtentX        =   4286
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0"
            DataType        =   1
            DecimalPlace    =   2
            Label           =   "Cash"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1160
            TextBoxWidth    =   1330
            Enabled         =   0   'False
            LinkForeColor   =   0
         End
         Begin ITGControls.ITGTextBox txtChecks 
            Height          =   285
            Left            =   165
            TabIndex        =   6
            TabStop         =   0   'False
            Top             =   2550
            Width           =   2550
            _ExtentX        =   4286
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0"
            DataType        =   1
            DecimalPlace    =   2
            Label           =   "Check"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1160
            TextBoxWidth    =   1330
            Enabled         =   0   'False
            LinkForeColor   =   0
         End
         Begin ITGControls.ITGTextBox txtTotalCredit 
            Height          =   285
            Left            =   5790
            TabIndex        =   7
            TabStop         =   0   'False
            Top             =   3615
            Width           =   2550
            _ExtentX        =   4286
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0"
            DataType        =   1
            DecimalPlace    =   2
            Label           =   "Total Credit"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1160
            TextBoxWidth    =   1330
            Enabled         =   0   'False
            LinkForeColor   =   0
         End
         Begin ITGControls.ITGTextBox txtDebit 
            Height          =   285
            Left            =   165
            TabIndex        =   8
            TabStop         =   0   'False
            Top             =   3180
            Width           =   2550
            _ExtentX        =   4286
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0"
            DataType        =   1
            DecimalPlace    =   2
            Label           =   "Debit"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1160
            TextBoxWidth    =   1330
            Enabled         =   0   'False
            LinkForeColor   =   0
         End
         Begin ITGControls.ITGTextBox txtTotalDebit 
            Height          =   285
            Left            =   165
            TabIndex        =   9
            TabStop         =   0   'False
            Top             =   3615
            Width           =   2550
            _ExtentX        =   4286
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0"
            DataType        =   1
            DecimalPlace    =   2
            Label           =   "Total Debit"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1160
            TextBoxWidth    =   1330
            Enabled         =   0   'False
            LinkForeColor   =   0
         End
         Begin ITGControls.ITGTextBox txtremark 
            Height          =   285
            Left            =   165
            TabIndex        =   18
            Top             =   2220
            Width           =   8385
            _ExtentX        =   14579
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Remark"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1160
            TextBoxWidth    =   7165
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtName 
            Height          =   285
            Left            =   2865
            TabIndex        =   20
            TabStop         =   0   'False
            Top             =   870
            Width           =   5670
            _ExtentX        =   9895
            _ExtentY        =   503
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   5610
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtCode 
            Height          =   285
            Left            =   165
            TabIndex        =   21
            Top             =   870
            Width           =   2355
            _ExtentX        =   3942
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Customer"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1160
            TextBoxWidth    =   1135
            Required        =   -1  'True
            LinkForeColor   =   16711680
         End
         Begin ITGControls.ITGTextBox txtReceived 
            Height          =   285
            Left            =   3255
            TabIndex        =   22
            Top             =   3120
            Visible         =   0   'False
            Width           =   5205
            _ExtentX        =   8969
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Receiced from"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1160
            TextBoxWidth    =   3985
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtDocType 
            Height          =   285
            Left            =   7260
            TabIndex        =   24
            Tag             =   "cboType"
            Top             =   2625
            Visible         =   0   'False
            Width           =   1155
            _ExtentX        =   1931
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Invoice Type"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   1095
         End
         Begin ITGControls.ITGTextBox txtProjectName 
            Height          =   285
            Left            =   2865
            TabIndex        =   27
            TabStop         =   0   'False
            Top             =   1200
            Width           =   5670
            _ExtentX        =   9895
            _ExtentY        =   503
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   5610
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtProject 
            Height          =   285
            Left            =   165
            TabIndex        =   28
            Top             =   1200
            Width           =   2355
            _ExtentX        =   3942
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Project"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1160
            TextBoxWidth    =   1135
            Required        =   -1  'True
            LinkForeColor   =   16711680
         End
         Begin ITGControls.ITGTextBox txtWorkDesc 
            Height          =   285
            Left            =   2865
            TabIndex        =   30
            TabStop         =   0   'False
            Top             =   1560
            Width           =   5670
            _ExtentX        =   9895
            _ExtentY        =   503
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   5610
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtWork 
            Height          =   285
            Left            =   165
            TabIndex        =   31
            Top             =   1560
            Width           =   2355
            _ExtentX        =   3942
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Work"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1160
            TextBoxWidth    =   1135
            Required        =   -1  'True
            LinkForeColor   =   16711680
         End
         Begin VB.Label Label6 
            BackColor       =   &H00F7D9C2&
            Caption         =   "Doc Type"
            Height          =   285
            Left            =   6150
            TabIndex        =   25
            Top             =   2565
            Width           =   705
         End
         Begin VB.Label Label1 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Date"
            Height          =   195
            Left            =   6225
            TabIndex        =   10
            Top             =   600
            Width           =   345
         End
         Begin VB.Line Line3 
            BorderColor     =   &H00000000&
            X1              =   210
            X2              =   2760
            Y1              =   3180
            Y2              =   3180
         End
      End
   End
   Begin ITGControls.ComunionFrames ComunionFrames2 
      Height          =   2655
      Left            =   30
      Top             =   4425
      Width           =   8850
      _ExtentX        =   15610
      _ExtentY        =   4683
      FrameColor      =   4210752
      BackColor       =   16243138
      FillColor       =   16243138
      RoundedCorner   =   0   'False
      Caption         =   "Details"
      Alignment       =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ThemeColor      =   5
      ColorFrom       =   16243138
      ColorTo         =   16250865
      Begin ITGControls.ITGTab SSTab1 
         Height          =   2205
         Left            =   0
         TabIndex        =   12
         Top             =   450
         Width           =   8850
         _ExtentX        =   15610
         _ExtentY        =   3889
         TabCaption(0)   =   "Payment"
         TabContCtrlCnt(0)=   2
         Tab(0)ContCtrlCap(1)=   "cboPayment"
         Tab(0)ContCtrlCap(2)=   "dtgPayment"
         TabCaption(1)   =   "Others"
         TabContCtrlCnt(1)=   2
         Tab(1)ContCtrlCap(1)=   "cboOthers"
         Tab(1)ContCtrlCap(2)=   "dtgOthers"
         TabCaption(2)   =   "Assets"
         TabContCtrlCnt(2)=   1
         Tab(2)ContCtrlCap(1)=   "dtgAsset"
         TabTheme        =   2
         ActiveTabBackStartColor=   16250865
         ActiveTabBackEndColor=   16243138
         InActiveTabBackStartColor=   16250865
         InActiveTabBackEndColor=   16243138
         BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         OuterBorderColor=   4210752
         TopLeftInnerBorderColor=   4210752
         BottomRightInnerBorderColor=   4210752
         DisabledTabBackColor=   16243138
         DisabledTabForeColor=   -2147483631
         Begin MSDataGridLib.DataGrid dtgAsset 
            Height          =   1890
            Left            =   -75000
            TabIndex        =   17
            Top             =   315
            Width           =   8850
            _ExtentX        =   15610
            _ExtentY        =   3334
            _Version        =   393216
            AllowUpdate     =   -1  'True
            AllowArrows     =   -1  'True
            BackColor       =   16777215
            HeadLines       =   1
            RowHeight       =   15
            TabAcrossSplits =   -1  'True
            TabAction       =   2
            FormatLocked    =   -1  'True
            AllowDelete     =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   5
            BeginProperty Column00 
               DataField       =   "cAssetNo"
               Caption         =   "Asset No."
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   "MM/dd/yyyy"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "cDesc"
               Caption         =   "Description"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column02 
               DataField       =   "nValue"
               Caption         =   "Value"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column03 
               DataField       =   "nLastDepre"
               Caption         =   "Total Depreciation"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column04 
               DataField       =   "nBook"
               Caption         =   "Book Value"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
                  Button          =   -1  'True
                  ColumnWidth     =   1200.189
               EndProperty
               BeginProperty Column01 
                  Locked          =   -1  'True
                  ColumnWidth     =   1920.189
               EndProperty
               BeginProperty Column02 
                  Alignment       =   1
                  Locked          =   -1  'True
               EndProperty
               BeginProperty Column03 
                  Alignment       =   1
                  Locked          =   -1  'True
               EndProperty
               BeginProperty Column04 
                  Alignment       =   1
                  Locked          =   -1  'True
               EndProperty
            EndProperty
         End
         Begin VB.ComboBox cboOthers 
            Height          =   315
            ItemData        =   "frmBasicGLIntAR.frx":03E2
            Left            =   -74880
            List            =   "frmBasicGLIntAR.frx":03EC
            Style           =   2  'Dropdown List
            TabIndex        =   16
            Top             =   1680
            Visible         =   0   'False
            Width           =   1515
         End
         Begin VB.ComboBox cboPayment 
            Height          =   315
            ItemData        =   "frmBasicGLIntAR.frx":03FF
            Left            =   120
            List            =   "frmBasicGLIntAR.frx":0401
            Style           =   2  'Dropdown List
            TabIndex        =   15
            Top             =   1800
            Visible         =   0   'False
            Width           =   1515
         End
         Begin MSDataGridLib.DataGrid dtgPayment 
            Height          =   1890
            Left            =   0
            TabIndex        =   14
            Top             =   315
            Width           =   8850
            _ExtentX        =   15610
            _ExtentY        =   3334
            _Version        =   393216
            AllowUpdate     =   -1  'True
            AllowArrows     =   -1  'True
            BackColor       =   16777215
            HeadLines       =   1
            RowHeight       =   15
            TabAcrossSplits =   -1  'True
            TabAction       =   2
            FormatLocked    =   -1  'True
            AllowDelete     =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   5
            BeginProperty Column00 
               DataField       =   "cType"
               Caption         =   "Type"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "0"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "cBank"
               Caption         =   "Bank"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column02 
               DataField       =   "cCheckNo"
               Caption         =   "Check No."
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column03 
               DataField       =   "dCheckDate"
               Caption         =   "Date"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "MM/dd/yyyy"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   3
               EndProperty
            EndProperty
            BeginProperty Column04 
               DataField       =   "nAmount"
               Caption         =   "Amount"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
                  Button          =   -1  'True
                  ColumnWidth     =   1110.047
               EndProperty
               BeginProperty Column01 
                  Button          =   -1  'True
                  ColumnWidth     =   1275.024
               EndProperty
               BeginProperty Column02 
                  ColumnWidth     =   2340.284
               EndProperty
               BeginProperty Column03 
                  ColumnWidth     =   1319.811
               EndProperty
               BeginProperty Column04 
                  Alignment       =   1
                  ColumnWidth     =   1604.976
               EndProperty
            EndProperty
         End
         Begin MSDataGridLib.DataGrid dtgOthers 
            Height          =   1890
            Left            =   -75000
            TabIndex        =   13
            Top             =   315
            Width           =   8850
            _ExtentX        =   15610
            _ExtentY        =   3334
            _Version        =   393216
            AllowUpdate     =   -1  'True
            AllowArrows     =   -1  'True
            BackColor       =   16777215
            HeadLines       =   1
            RowHeight       =   15
            TabAcrossSplits =   -1  'True
            TabAction       =   2
            FormatLocked    =   -1  'True
            AllowDelete     =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   5
            BeginProperty Column00 
               DataField       =   "cType"
               Caption         =   "Type"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "cAcctNo"
               Caption         =   "Account No."
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   "MM/dd/yyyy"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column02 
               DataField       =   "cTitle"
               Caption         =   "Account Title"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column03 
               DataField       =   "cDesc"
               Caption         =   "Description"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column04 
               DataField       =   "nAmount"
               Caption         =   "Amount"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
                  Button          =   -1  'True
                  Locked          =   -1  'True
                  ColumnWidth     =   1005.165
               EndProperty
               BeginProperty Column01 
                  Button          =   -1  'True
                  Locked          =   -1  'True
                  ColumnWidth     =   1200.189
               EndProperty
               BeginProperty Column02 
                  Locked          =   -1  'True
                  ColumnWidth     =   1920.189
               EndProperty
               BeginProperty Column03 
                  ColumnWidth     =   2115.213
               EndProperty
               BeginProperty Column04 
                  Alignment       =   1
                  Object.Visible         =   -1  'True
                  ColumnWidth     =   1440
               EndProperty
            EndProperty
         End
      End
   End
End
Attribute VB_Name = "frmBasicGLIntAR"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private oPrint As New clsPrinting

Private AutoNum As New clsAutoNumber '---Added
Public MenuName As String '---Added

Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1
Private rsPayment As ADODB.Recordset
Private rsOthers As ADODB.Recordset
Private rsAsset As ADODB.Recordset

Private connHeader As ADODB.Connection
Private connPayment As ADODB.Connection
Private connOthers As ADODB.Connection
Private connAsset As ADODB.Connection

Enum eBasicIntARMode
    Normal
    AddNewEdit
    Find
End Enum
Public Mode As eBasicIntARMode

Public dtgName As String
Public sBit As String
Private vBM As Variant
Private lNew As Boolean

Private lSystemGenerated As Boolean
Public strNo As String

Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean

Private lSysTransDate As Boolean 'add by denz:2/17/2011 for transdate
Private Sub cboDocType_Change()
txtDocType = Trim(cboDocType)
End Sub

Private Sub cboDocType_Click()
txtDocType = Trim(cboDocType)
End Sub

Private Sub cboOthers_Click()
    If dtgOthers.Col = 0 Then
        rsOthers!cType = cboOthers
    End If
End Sub

Private Sub cboOthers_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        If dtgOthers.Col = 0 Then
            rsOthers!cType = cboOthers
            cboOthers.Visible = False
            dtgOthers.Col = 1
            dtgOthers.SetFocus
        End If
    ElseIf KeyCode = vbKeyEscape Then
        cboOthers.Visible = False
    End If
End Sub

Private Sub cboOthers_LostFocus()
    cboOthers.Visible = False
End Sub

Private Sub cboPayment_Click()
    If dtgPayment.Col = 0 Then
        rsPayment!cType = cboPayment
    End If
End Sub

Private Sub cboPayment_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        If dtgPayment.Col = 0 Then
            rsPayment!cType = cboPayment
            cboPayment.Visible = False
            dtgPayment.Col = 1
            dtgPayment.SetFocus
        End If
    ElseIf KeyCode = vbKeyEscape Then
        cboPayment.Visible = False
    End If
End Sub

Private Sub cboPayment_LostFocus()
    cboPayment.Visible = False
End Sub

Private Sub cmdPickCode_Click()
    If lPickListActive Then Exit Sub
    sFilterString = Trim(txtCode)
    With frmITGPicker
        .zType = QCustomer
        'added condition
        frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
        .Show vbModal
        txtCode = .zCode
        txtName = GetValueFrTable("cName", "client_customer", "cCode = '" & Trim(txtCode) & "'")
        rsHeader!cAddress = GetAddress("client_customer", "cCode = '" & Trim(txtCode) & "'") & ""
        txtReceived = txtName
    End With
End Sub

Private Sub dtgList_HeadClick(ByVal ColIndex As Integer)
    SortGrid dtgList, ColIndex, rsHeader
End Sub

Private Sub dtgAsset_AfterColUpdate(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0
            If GetValueFrTable("cAssetNo", "ASSET", "cAssetNo = '" & Trim(dtgAsset.Columns(0).Text) & "'") <> "" Then
                dtgAsset.Columns(1).Value = GetValueFrTable("cDesc", "ASSET", "cAssetNo = '" & Trim(dtgAsset.Columns(0).Text) & "'")
                dtgAsset.Columns(2).Value = GetValueFrTable("nValue", "ASSET", "cAssetNo = '" & Trim(dtgAsset.Columns(0).Text) & "'")
                dtgAsset.Columns(3).Value = GetValueFrTable("nLastDepre", "ASSET", "cAssetNo = '" & Trim(dtgAsset.Columns(0).Text) & "'")
                dtgAsset.Columns(4).Value = GetValueFrTable("nBook", "ASSET", "cAssetNo = '" & Trim(dtgAsset.Columns(0).Text) & "'")
                TotalOthersAmount
                TotalAmount
            End If
    End Select
End Sub

Private Sub dtgAsset_ButtonClick(ByVal ColIndex As Integer)

    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0
            If lPickListActive Then Exit Sub
            sFilterString = Trim(dtgAsset.Columns(0).Text)
            frmITGPickList.mType = Asset
            frmITGPickList.Show vbModal
            If Trim(frmITGPickList.mCode) = "" Then Exit Sub
            dtgAsset.Columns(0).Value = frmITGPickList.mCode & ""
            dtgAsset.Columns(1).Value = frmITGPickList.mName & ""
            dtgAsset.Columns(2).Value = GetValueFrTable("nValue", "ASSET", "cAssetNo = '" & Trim(dtgAsset.Columns(0).Text) & "'")
            dtgAsset.Columns(3).Value = GetValueFrTable("nLastDepre", "ASSET", "cAssetNo = '" & Trim(dtgAsset.Columns(0).Text) & "'")
            dtgAsset.Columns(4).Value = GetValueFrTable("nBook", "ASSET", "cAssetNo = '" & Trim(dtgAsset.Columns(0).Text) & "'")
            TotalOthersAmount
            TotalAmount
    End Select

End Sub

Private Sub dtgAsset_Click()
    If Mode = AddNewEdit Then dtgName = dtgAsset.Name
End Sub

Private Sub dtgAsset_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgAsset_GotFocus()
    dtgName = dtgAsset.Name
End Sub

Private Sub dtgAsset_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgAsset_KeyPress(KeyAscii As Integer)

    If Mode <> AddNewEdit Then Exit Sub
    If rsAsset.RecordCount = 0 Then Exit Sub

    If KeyAscii = 39 Then KeyAscii = 0

    If KeyAscii = 13 Then
        Select Case dtgAsset.Col
            Case 0
                If GetValueFrTable("cAssetNo", "ASSET", "cAssetNo = '" & Trim(dtgAsset.Columns(0).Text) & "'") = "" Then dtgAsset_ButtonClick (0)
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii)))
    End If

End Sub

Private Sub dtgAsset_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgAsset.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub dtgOthers_AfterColUpdate(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 1
            If GetValueFrTable("cAcctNo", "ACCOUNT", "cAcctNo = '" & Trim(dtgOthers.Columns(1).Text) & "' and cType = 'Details' ") <> "" Then
                dtgOthers.Columns(2).Value = GetValueFrTable("cTitle", "ACCOUNT", "cAcctNo = '" & Trim(dtgOthers.Columns(1).Text) & "'")
                dtgOthers.Col = 3
                dtgOthers.Columns(3).Value = rsOthers!cDesc
            ElseIf GetValueFrTable("cAcctNo", "ACCOUNT", "cAcctNo = '" & Trim(dtgOthers.Columns(1).Text) & "' and cType = 'General' ") <> "" Then
                MsgBox "General Account.", vbInformation
                dtgOthers.Columns(ColIndex).Text = ""
                dtgOthers.Col = ColIndex
                dtgOthers.SetFocus
            End If
        Case 4
            TotalOthersAmount
            TotalAmount
    End Select
End Sub

Private Sub dtgOthers_ButtonClick(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0 'Detail type
            MoveCombo cboOthers, dtgOthers, dtgOthers.Columns(0)
            ComboLoadValue cboOthers, Trim(dtgOthers.Columns(0).Text)
            cboOthers.SetFocus
        Case 1 'Account Number
            If lPickListActive Then Exit Sub
            sFilterString = Trim(dtgOthers.Columns(1).Text)
            frmITGPicker.zType = QAccounts
            frmITGPicker.Show vbModal
            If Trim(frmITGPicker.zCode) = "" Then Exit Sub
            dtgOthers.Columns(1).Value = frmITGPicker.zCode & ""
            dtgOthers.Columns(2).Value = frmITGPicker.zName & ""
            dtgOthers.Col = 3
            dtgOthers.Columns(3).Value = rsOthers!cDesc
    End Select
End Sub

Private Sub dtgOthers_Click()
    If Mode = AddNewEdit Then dtgName = dtgOthers.Name
End Sub

Private Sub dtgOthers_Error(ByVal DataError As Integer, Response As Integer)
    If Mode <> AddNewEdit Then
        Response = 0
        Exit Sub
    End If
    If DataError = 7007 Then
        MsgBox "Type mismatch", vbExclamation, msgTtl
    ElseIf DataError = 13 Then
        MsgBox "Type mismatch", vbExclamation, msgTtl
    End If
    Response = 0
End Sub

Private Sub dtgOthers_GotFocus()
    dtgName = dtgOthers.Name
End Sub

Private Sub dtgOthers_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgOthers_KeyPress(KeyAscii As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If rsOthers.RecordCount = 0 Then Exit Sub
    
    If KeyAscii = 39 Then KeyAscii = 0
    
    If KeyAscii = 13 Then
        Select Case dtgOthers.Col
            Case 0
                If Not cboOthers.Visible Then dtgOthers_ButtonClick 0
            Case 1
                If GetValueFrTable("cAcctNo", "ACCOUNT", "cAcctNo = '" & Trim(dtgOthers.Columns(1).Text) & "'") = "" Then
                    dtgOthers_ButtonClick (1)
                End If
            Case 4
                TBNewLine
                dtgOthers.LeftCol = 0
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii)))
    End If
End Sub

Private Sub dtgOthers_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgOthers.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub dtgPayment_AfterColUpdate(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 1
            If GetValueFrTable("cBankID", "BANK", "cBankID = '" & Trim(dtgPayment.Columns(1).Text) & "'") <> "" Then
                dtgPayment.Col = 2
                dtgPayment.Columns(2).Value = rsPayment!cCheckNo
            End If
        Case 2
            If Trim(rsPayment!cType) = "CSH" Then Exit Sub
            If Trim(rsPayment!cType) = "OFF" Then Exit Sub
            If CheckExisting(rsPayment!cCheckNo, rsPayment!cBank, rsHeader!cTranNo, rsPayment, True) Then
                MsgBox "Check already exist."
                Exit Sub
            End If
        Case 4
            TotalPaymentAmount
            TotalAmount
    End Select
End Sub

Private Sub dtgPayment_ButtonClick(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0
            Call LoadComboValues(cboPayment, "cValue", "PARAMETER_USER", "WHERE cCompanyID = '" & COID & "' AND cType = 'PAYTYPE'", "nOrder")
            Call MoveCombo(cboPayment, dtgPayment, dtgPayment.Columns(0))
            ComboLoadValue cboPayment, Trim(dtgPayment.Columns(0).Text)
        Case 1
            If lPickListActive Then Exit Sub
            frmITGPickList.mType = Bank
            frmITGPickList.Show vbModal
            If Trim(frmITGPickList.mCode) = "" Then Exit Sub
            dtgPayment.Columns(1).Value = frmITGPickList.mCode & ""
            dtgPayment.Col = 2
            dtgPayment.Columns(2).Value = rsPayment!cCheckNo
    End Select
End Sub

Private Sub dtgPayment_Click()
    If Mode = AddNewEdit Then dtgName = dtgPayment.Name
End Sub

Private Sub dtgPayment_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgPayment_GotFocus()
    dtgName = dtgPayment.Name
End Sub

Private Sub dtgPayment_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgPayment_KeyPress(KeyAscii As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If rsPayment.RecordCount = 0 Then Exit Sub
    
    If KeyAscii = 39 Then KeyAscii = 0
    
    If KeyAscii = 13 Then
        Select Case dtgPayment.Col
            Case 0
                If Not cboPayment.Visible Then dtgPayment_ButtonClick 0
            Case 1
                If GetValueFrTable("cBankID", "BANK", "cBankID = '" & Trim(dtgPayment.Columns(1).Text) & "'") = "" Then
                    If Trim(dtgPayment.Columns(0).Text) = "CSH" Then
                        SendKeys "{Tab}"
                        SendKeys "{Tab}"
                        dtgPayment.Columns(3).Text = Format(Date, "MM/dd/yyyy")
                    Else
                        dtgPayment_ButtonClick (1) 'use button click
                    End If
                End If
            Case 4
                TBNewLine
                dtgPayment.LeftCol = 0
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii)))
    End If
End Sub

Private Sub dtgPayment_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgPayment.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub

Private Sub Form_Load()

    Set FrmName = Me
    FormSetup

       AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'BGL02'")
    
    Set rsHeader = New ADODB.Recordset
    Set rsPayment = New ADODB.Recordset
    Set rsOthers = New ADODB.Recordset
    Set rsAsset = New ADODB.Recordset
    
    Call LoadComboValues(cboDocType, "cValue", "PARAMETER_USER", "WHERE cType = 'BSAORDOCTYPE' AND cCompanyID = '" & Trim(COID) & "'")
    FormLocking True
    FormSearch True
    SearchObj True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True

    Mode = Find
    txtTranNo.Locked = False
    
End Sub

Private Sub Form_Activate()
    TBBitReload
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    If Mode = AddNewEdit Then
        MsgBox "Unable to close. You are in Add/New/Edit mode." & vbCr & _
            " Must Save or Undo", vbCritical, Me.Caption
        Cancel = True
        Exit Sub
    End If
    
    CloseMenuTab ITGLedgerMain
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False
    
    Set oPrint = Nothing
    Set rsHeader = Nothing
    Set rsPayment = Nothing
    Set rsOthers = Nothing
    Set rsAsset = Nothing
    Set connHeader = Nothing
    Set connPayment = Nothing
    Set connOthers = Nothing
    Set connAsset = Nothing
    
    Set frmBasicGLIntAR = Nothing

    lCloseWindow = True
    
    'oForm(Me.Tag).Mode = 1
    'oForm(Me.Tag).Tag = Me.Tag
End Sub

'Add new record to the recordset
Public Sub TBNew()
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    txtTranNo.BackColor = &HE0FFFF
    Mode = AddNewEdit
    
    If rsHeader.State <> adStateOpen Then
        OpenNewConnection connAsset
        OpenNewConnection connOthers
        OpenNewConnection connPayment
        OpenNewConnection connHeader
        OpenRecordsetWithCN rsAsset, "*", "INTAR_A", connAsset, "WHERE 1 = 0"
        OpenRecordsetWithCN rsOthers, "*", "INTAR_T", connOthers, "WHERE 1 = 0"
        OpenRecordsetWithCN rsPayment, "*", "INTAR_C", connPayment, "WHERE 1 = 0"
        OpenRecordsetWithCN rsHeader, "*", "INTAR", connHeader, "WHERE 1 = 0"
        SetDataSource
        SetDataField
    Else
        vBM = rsHeader.Bookmark
    End If
    
    rsHeader.AddNew
    rsHeader!cCompanyID = COID
    rsHeader!dDate = Date
    rsHeader!cdoctype = "DOC 1"
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    SSTab1.ActiveTab = 0
    txtTranNo.SetFocus
    txtTranNo.Locked = True
    cboDocType.Enabled = False
    lNew = True
    
    MenuName = "AUTO_NUMBER_AR"
    lSystemGenerated = GetValueFrTable("lAutoNo", "system_autonumber", "cCode = '" & MenuName & "' ")
    If lSystemGenerated Then rsHeader!cTranNo = AutoNum.Generate_CtrlNo2(MenuName, Format(Now, "mm/dd/yyyy"))

    strNo = rsHeader!cTranNo
End Sub

Public Sub TBUndoAll()
On Error GoTo ErrorHandler

    Mode = Normal
    
    If rsHeader.Status = adRecNew Then TBUndoCurrent
    
    rsHeader.CancelBatch adAffectAll
    rsPayment.CancelBatch adAffectAll
    rsOthers.CancelBatch adAffectAll
    rsAsset.CancelBatch adAffectAll
    
    UnbindControls
    
    If rsHeader.RecordCount <> 0 Then rsHeader.Bookmark = vBM
    
    Set FrmName = Me
    FormLocking True
    
    If rsHeader.RecordCount <> 0 Then
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True
    Else
        RSZero
        Mode = Find
    End If
    
    sbRS.Panels(2) = ""
    
    SetDataSource
    SetDataField

ErrorHandler:
    
    cboOthers.Visible = False
    cboPayment.Visible = False
    
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then
        TBUndoAll
    End If

End Sub

Public Sub TBUndoCurrent()
On Error GoTo ErrorHandler

    GetChild
    If rsHeader.Status = adRecNew Then
        rsAsset.CancelBatch adAffectAll
        rsPayment.CancelBatch adAffectAll
        rsOthers.CancelBatch adAffectAll
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
        rsPayment.CancelBatch adAffectAll
        rsOthers.CancelBatch adAffectAll
        rsAsset.CancelBatch adAffectAll
    End If
   
    If rsHeader.RecordCount = 0 Then RSZero
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then
        TBUndoCurrent
    End If

End Sub

Public Sub TBSave()
Dim OKUpdate As Boolean
On Error GoTo ErrHandler

   
    lBoolean = False
    If rsHeader.Status = adRecNew Then lBoolean = True
    
    If Not MandatoryOK Then Exit Sub
    
       If rsHeader.Status = adRecNew Then
    
        If lSystemGenerated Then
            'If ChkCtrlNo(rsHeader, "AUTO_NUMBER_AR", "INTAR", "cTranNo", rsHeader!cTranNo) <> rsHeader!cTranNo Then
            If AutoNum.Check_CtrlNo2(rsHeader, "INTAR", "cTranNo", rsHeader!cTranNo, MenuName, rsHeader!dDate) <> rsHeader!cTranNo Then

                GetChild
                
                rsHeader!cTranNo = strNo
                
                If rsPayment.RecordCount <> 0 Then rsPayment.MoveFirst
                Do Until rsPayment.EOF
                    rsPayment!cTranNo = strNo
                    rsPayment.MoveNext
                Loop
                
                If rsOthers.RecordCount <> 0 Then rsOthers.MoveFirst
                Do Until rsOthers.EOF
                    rsOthers!cTranNo = strNo
                    rsOthers.MoveNext
                Loop
                
                If rsAsset.RecordCount <> 0 Then rsAsset.MoveFirst
                Do Until rsAsset.EOF
                    rsAsset!cTranNo = strNo
                    rsAsset.MoveNext
                Loop
                
                GetChild
            End If
        End If
    End If
    
    OKUpdate = False
    cn.BeginTrans
    connHeader.BeginTrans
    connPayment.BeginTrans
    connOthers.BeginTrans
    connAsset.BeginTrans
    
    rsHeader.UpdateBatch adAffectAll
    rsPayment.UpdateBatch adAffectAll
    rsOthers.UpdateBatch adAffectAll
    rsAsset.UpdateBatch adAffectAll
    
    cn.CommitTrans
    connHeader.CommitTrans
    connPayment.CommitTrans
    connOthers.CommitTrans
    connAsset.CommitTrans
    OKUpdate = True
    
    Set FrmName = Me
    FormLocking True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True
    Mode = Normal
    
    AddToChecksTable
    

    UpdateLogFile "Acknowledgment", Trim(txtTranNo), IIf(lBoolean, "Inserted", "Updated")
 
    UpdateGLA "Update", "ACR", Trim(txtTranNo)
     
    If lBoolean Then
        If lSystemGenerated And strNo = rsHeader!cTranNo Then
            UpdateControlNo strNo, rsHeader!cTranNo, "AUTO_NUMBER_AR"
            AutoNum.Update_CtrlNo2 strNo, MenuName, Format(Now, "mm/dd/yyyy")
        End If
    End If
    
    If lBoolean = False Then ' Edit
            cn.Execute ("UPDATE INTAR SET  dUpdated = GETDATE() WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")
    Else ' Insert
            cn.Execute ("UPDATE INTAR SET  dUpdated = GETDATE() WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")
    End If
    MsgBox "Record/s successfully saved.", vbInformation, msgTtl
    
    sbRS.Panels(2) = ""

ErrHandler:

    cboOthers.Visible = False
    cboPayment.Visible = False

    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        OKUpdate = True
        cn.RollbackTrans
        connHeader.RollbackTrans
        connPayment.RollbackTrans
        connOthers.RollbackTrans
        connAsset.RollbackTrans
        MsgBox "Record cannot be updated. Some values may have been changed by other user/s since last read." & vbCr & _
                "Records will be automatically refreshed. All changes made to the record will be gone upon refresh.", vbInformation, msgTtl
        vBookMark = rsHeader.Bookmark
        UnbindControls
        rsHeader.Requery
        rsPayment.Requery
        rsOthers.Requery
        rsAsset.Requery
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True
        Mode = Normal
        If rsHeader.RecordCount <> 0 Then
            Set FrmName = Me
            FormLocking True
            SetDataField
            SetDataSource
            rsHeader.Bookmark = vBookMark
        Else
            RSZero
        End If
    End If
    If Not OKUpdate Then
        MsgBox "Transaction update failed.", vbInformation, msgTtl
        cn.RollbackTrans
        connHeader.RollbackTrans
        connPayment.RollbackTrans
        connOthers.RollbackTrans
        connAsset.RollbackTrans
        ErrorLog err.Number, err.Description, Me.Name 'Error log
    End If
    
End Sub

Public Sub TBEdit()
    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled. Edit is not allowed.", vbExclamation, msgTtl
        Exit Sub
    End If
    Mode = AddNewEdit
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    txtTranNo.Locked = True
    SSTab1.ActiveTab = 0
    dtbDate.SetFocus
    vBM = rsHeader.Bookmark
    lNew = False

    MenuName = "AUTO_NUMBER_AR"
    lSysTransDate = GetValueFrTable("lTransDate", "system_autonumber", "cCode = '" & MenuName & "' ") 'add by denz:2/17/2011
    If lSysTransDate Then
        dtbDate.Enabled = True
    Else: dtbDate.Enabled = False
    End If
End Sub

Public Sub TBDelete()
On Error GoTo ErrorHandler
    
    sID = Trim(txtTranNo)
    
    If rsHeader.RecordCount = 0 Then Exit Sub
    
    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled. Deletion is not allowed.", vbExclamation, msgTtl
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, msgTtl) = vbNo Then Exit Sub
    
    cn.Execute "DELETE CHECKS WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "' AND cTransType = 'AR'"

    UpdateGLA "Delete", "ACR", Trim(txtTranNo)
    
    GetChild
    If rsPayment.RecordCount <> 0 Then
        rsPayment.MoveFirst
        Do Until rsPayment.RecordCount = 0
            rsPayment.Delete adAffectCurrent
            If rsPayment.RecordCount <> 0 Then rsPayment.MoveFirst
        Loop
    End If
    If rsOthers.RecordCount <> 0 Then
        rsOthers.MoveFirst
        Do Until rsOthers.RecordCount = 0
            rsOthers.Delete adAffectCurrent
            If rsOthers.RecordCount <> 0 Then rsOthers.MoveFirst
        Loop
    End If
    If rsAsset.RecordCount <> 0 Then
        rsAsset.MoveFirst
        Do Until rsAsset.RecordCount = 0
            rsAsset.Delete adAffectCurrent
            If rsAsset.RecordCount <> 0 Then rsAsset.MoveFirst
        Loop
    End If
    
    'Audit trail
    UpdateLogFile "Acknowledgment", Trim(txtTranNo), "Deleted"

    rsHeader.Delete adAffectCurrent
    rsPayment.UpdateBatch adAffectAll
    rsOthers.UpdateBatch adAffectAll
    rsAsset.UpdateBatch adAffectAll
    rsHeader.UpdateBatch adAffectAll
    
    TBPrevRec

    Mode = Normal
    
    If rsHeader.RecordCount = 0 Then
        RSZero
    End If
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        cn.Execute "DELETE INTAR_A WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE INTAR_T WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE INTAR_C WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE INTAR WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        Resume Next
        
        ''
        Else
        cn.Execute "DELETE INTAR_A WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE INTAR_T WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE INTAR_C WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE INTAR WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        Resume Next
        
    End If

End Sub

Public Sub TBFind()
    Mode = Normal
    txtTranNo.Locked = True
    frmITGSearch.Show
End Sub

Public Sub TBFindPrimary()
Dim sTemp As String
If Mode = Find Then
    FormWaitShow App.Path & "\Transmit.avi", "Loading data . . ."
        
    OpenNewConnection connAsset
    OpenNewConnection connOthers
    OpenNewConnection connPayment
    OpenNewConnection connHeader

    Set rsHeader = Nothing
    Set rsPayment = Nothing
    Set rsOthers = Nothing
    Set rsAsset = Nothing
    Set rsHeader = New ADODB.Recordset
    Set rsPayment = New ADODB.Recordset
    Set rsOthers = New ADODB.Recordset
    Set rsAsset = New ADODB.Recordset
            
    sTemp = Trim$(GetSearchString)
    If sTemp = "ERROR" Then
        MsgBox "Only Allows A - Z, 0 - 9, '.', ',' and %(wildcard)", vbExclamation, ""
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
        txtTranNo.Locked = False
        txtTranNo.SetFocus
        Exit Sub
    End If
            
    OpenRecordsetWithCN rsHeader, "*", "INTAR", connHeader, IIf(sTemp = "", "", " where " & sTemp)
    'OpenRecordsetWithCN rsAsset, "*", "INTAR_A", connAsset
    'OpenRecordsetWithCN rsOthers, "*", "INTAR_T", connOthers
    'OpenRecordsetWithCN rsPayment, "*", "INTAR_C", connPayment
                   
    OpenRecordsetWithCN rsAsset, "*", "INTAR_A", connAsset, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM INTAR WHERE " & sTemp & ")")
    OpenRecordsetWithCN rsOthers, "*", "INTAR_T", connOthers, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM INTAR WHERE " & sTemp & ")")
    OpenRecordsetWithCN rsPayment, "*", "INTAR_C", connPayment, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM INTAR WHERE " & sTemp & ")")
                    
    Set FrmName = Me
    FormLocking True
            
        If rsHeader.RecordCount = 0 Then
        FormWaitHide
        MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
        RSZero
        FormSearch True
        SearchObj True
        Mode = Find
        Exit Sub
    End If
    SetDataSource
    SetDataField
    txtTranNo.BackColor = &HE0FFFF
    Mode = Normal
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True

    FormWaitHide
Else
    RSZero
    FormSearch True
    SearchObj True
    Mode = Find
   
End If

End Sub

Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    Set FrmName = Me
    dtgName = dtgPayment.Name
End Sub

Public Sub TBCloseWindow()
    Unload Me
End Sub

Public Sub TBFirstRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveFirst rsHeader

End Sub

Public Sub TBPrevRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MovePrevious rsHeader
    
End Sub

Public Sub TBNextRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveNext rsHeader

End Sub

Public Sub TBLastRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveLast rsHeader

End Sub

Public Sub TBNewLine()
    
    If rsHeader!cTranNo = "" Then Exit Sub

    If dtgName = "dtgPayment" Then
        rsPayment.AddNew
        rsPayment!cCompanyID = COID
        rsPayment!cTranNo = Trim(txtTranNo)
        dtgPayment.Col = 0
        GetChild
        If rsPayment.RecordCount <> 0 Then rsPayment.MoveLast
        dtgPayment.SetFocus
    ElseIf dtgName = "dtgOthers" Then
        rsOthers.AddNew
        rsOthers!cCompanyID = COID
        rsOthers!cTranNo = Trim(txtTranNo)
        dtgOthers.Col = 0
        GetChild
        If rsOthers.RecordCount <> 0 Then rsOthers.MoveLast
        dtgOthers.SetFocus
    ElseIf dtgName = "dtgAsset" Then
        rsAsset.AddNew
        rsAsset!cCompanyID = COID
        rsAsset!cTranNo = Trim(txtTranNo)
        dtgAsset.Col = 0
        GetChild
        If rsAsset.RecordCount <> 0 Then rsAsset.MoveLast
        dtgAsset.SetFocus
    End If

End Sub

Public Sub TBDeleteLine()
On Error GoTo ErrorHandler

    If dtgName = "dtgPayment" Then
        If rsPayment.RecordCount = 0 Then Exit Sub
        vBookMark = dtgPayment.Bookmark
        GetChild
        dtgPayment.Bookmark = vBookMark
        rsPayment.Delete adAffectCurrent
    ElseIf dtgName = "dtgOthers" Then
        If rsOthers.RecordCount = 0 Then Exit Sub
        vBookMark = dtgOthers.Bookmark
        GetChild
        dtgOthers.Bookmark = vBookMark
        rsOthers.Delete adAffectCurrent
    ElseIf dtgName = "dtgAsset" Then
        If rsAsset.RecordCount = 0 Then Exit Sub
        vBookMark = dtgAsset.Bookmark
        GetChild
        dtgAsset.Bookmark = vBookMark
        rsAsset.Delete adAffectCurrent
    End If
    
    GetChild
    
    TotalPaymentAmount
    TotalOthersAmount
    TotalAmount

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Public Sub TBUndoLineAll()
On Error GoTo ErrorHandler
    
    MsgBox "Unavailable on " & Me.Name

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If
End Sub

Public Sub TBUndoLineCurrent()
    MsgBox "Unavailable on " & Me.Name
End Sub

Public Sub TBPostRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub

Public Sub TBCancelRecord()
On Error GoTo ErrorHandler
    
    If rsHeader.RecordCount = 0 Then Exit Sub

    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled.", vbExclamation, msgTtl
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to cancel this record?", vbQuestion + vbYesNo, msgTtl) = vbNo Then Exit Sub

    'Audit trail
    UpdateLogFile "Acknowledgment", Trim(txtTranNo), "Cancelled"

    cn.Execute ("UPDATE INTAR SET lCancelled = 1 , dUpdated = GETDATE () WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")
    
    sbRS.Panels(5) = "CANCELLED"
    Mode = Normal
    
    rsHeader!lCancelled = True
    rsHeader.UpdateBatch adAffectAll

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub


Public Sub TBPrintRecord()
    If Trim(txtTranNo) = "" Then Exit Sub
    If rsHeader!cdoctype <> "" Then
        RepName = GetValueFrTable("cParamName", "PARAMETER_USER", "cType = 'BSAORDOCTYPE' AND cValue = '" & Trim(cboDocType) & "'")
    Else: RepName = "Basic_Acknow_Official_Receipt_Trans"
    End If
    cModule = "Basic_Acknow_Official_Receipt"
    oPrint.PrintReceipt Trim(txtTranNo)
End Sub

Sub SetDataSource()
    Set FrmName = Me
    BindControls rsHeader
    Set dtgPayment.DataSource = rsPayment
    Set dtgOthers.DataSource = rsOthers
    Set dtgAsset.DataSource = rsAsset
    Set dtgList.DataSource = rsHeader
   
End Sub

Sub SetDataField()
    With rsHeader
        txtTranNo.DataField = !cTranNo
        dtbDate.DataField = !dDate
        txtReceived.DataField = !cReceived
        txtChecks.DataField = !nCheck
        txtCash.DataField = !nCash
        txtDebit.DataField = !nDebit
        txtTotalCredit.DataField = !nCredit
        txtTotalDebit.DataField = !nTotalDebit
        txtremark.DataField = !cRemark
        txtAddress.DataField = !cAddress
        txtCode.DataField = !cCode
        txtName.DataField = !cName
        txtDocType.DataField = !cdoctype
        txtProject.DataField = !cProjectID
        txtWork.DataField = !cWorkID
    End With
End Sub

Private Sub rsHeader_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
On Error GoTo ErrorHandler
    
    If Not (rsHeader.EOF) Or Not (rsHeader.BOF) Then
        sbRS.Panels(1) = "Record: " & IIf((rsHeader.AbsolutePosition = -2), "0", rsHeader.AbsolutePosition) & "/" & rsHeader.RecordCount
        
        If rsHeader.Status <> adRecNew Then
            txtTranNo.Locked = True
        Else
            txtTranNo.Locked = False
        End If
        
        If Mode = AddNewEdit Then
            Select Case rsHeader.Status
                Case adRecNew
                    sbRS.Panels(2) = "New"
                Case adRecModified
                    sbRS.Panels(2) = "Modified"
                Case Else
                    sbRS.Panels(2) = ""
            End Select
        Else
            sbRS.Panels(2) = ""
        End If
        
        GetChild
        
        If rsHeader!lCancelled = True Then
            sbRS.Panels(5) = "CANCELLED"
        Else
            sbRS.Panels(5) = ""
        End If
        
    Else
        sbRS.Panels(1) = "Record: 0/0"
        sbRS.Panels(2) = ""
        txtTranNo.Locked = False
    End If

    If Mode = AddNewEdit Then
        dtgPayment.Refresh
        dtgOthers.Refresh
        dtgAsset.Refresh
    End If
        
ErrorHandler:
   
    If err.Number = -2147217885 Then
        Resume Next
    End If
    
End Sub

Private Sub Timer1_Timer()
    If Mode = AddNewEdit Then
        SSTab2.TabEnabled(1) = False
    Else
        SSTab2.TabEnabled(1) = True
    End If
End Sub

Private Sub txtCode_Change()
    txtName = ""
    txtName = GetValueFrTable("cName", "client_customer", "cCode = '" & Trim(txtCode) & "'")
    txtAddress = GetAddress("client_customer", "cCode = '" & Trim(txtCode) & "'") & ""
    txtReceived = txtName
End Sub

Private Sub txtDocType_Change()
    If Trim(txtDocType) <> "" Or txtDocType <> vbNullString Then
        If GetValueFrTable("cValue", "PARAMETER_USER", "cType = 'BSAORDOCTYPE' AND cValue = '" & Trim(txtDocType) & "' ", False) <> "" Then
            cboDocType = Trim(txtDocType)
        Else: cboDocType.ListIndex = -1
        End If
    Else: cboDocType.ListIndex = -1
    End If
End Sub

Private Sub txtReceived_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If rsPayment.RecordCount = 0 Then
        dtgName = dtgPayment.Name
        SSTab1.ActiveTab = 0
        TBNewLine
    End If
End Sub

Private Sub txtTranNo_LostFocus()
 
    If Mode = AddNewEdit Then
        If Trim(txtTranNo) = "" Then
            MsgBox "Empty primary input.", vbInformation, msgTtl
            If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
            txtTranNo.SetFocus
        Else
            If rsHeader.Status <> adRecNew Then Exit Sub
            txtTranNo = Trim(txtTranNo)
            If IDExisting(rsHeader, "cTranNo", "INTAR", Trim(rsHeader!cTranNo)) Then
                MsgBox "Receipt No. already exists.", vbInformation, msgTtl
                If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
                txtTranNo.SetFocus
                Exit Sub
            End If
        End If
    End If
End Sub

Function MandatoryOK() As Boolean
    
    MandatoryOK = True
    
    If Trim(txtTranNo) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Receipt Number' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtTranNo.SetFocus
        Exit Function
    End If
    
    TotalPaymentAmount
    TotalOthersAmount
    TotalAmount
    
    If CDbl(txtTotalDebit) <> CDbl(txtTotalCredit) Then
        MsgBox "Unbalanced transaction!", vbCritical, msgTtl
        MandatoryOK = False
        Exit Function
    End If
    
    If rsHeader.Status = adRecNew And lSystemGenerated = False Then
        If IDExisting(rsHeader, "cTranNo", "INTAR", Trim(rsHeader!cTranNo)) Then
            MandatoryOK = False
            MsgBox "Receipt No. already exists.", vbInformation, msgTtl
            txtTranNo.SetFocus
            Exit Function
        End If
    End If
    
      If Trim(dtbDate.Text) = "__/__/____" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Date' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        dtbDate.SetFocus
        Exit Function
    ElseIf Trim(txtReceived) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Received From' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtReceived.SetFocus
        Exit Function
    ElseIf Trim(txtDocType) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Doc Type' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtDocType.SetFocus
        Exit Function
    End If
    
    
    
    GetChild
    
    If rsPayment.RecordCount <> 0 Then rsPayment.MoveFirst
    Do Until rsPayment.EOF
        If rsPayment.Status = (adRecNew) Or rsPayment.Status = (adRecModified) Then
            If IsNull(rsPayment!cType) Then
                rsPayment.Delete
            ElseIf Trim(rsPayment!cType) = "" Then
                rsPayment.Delete
            Else
                rsPayment.MoveNext
            End If
        Else
            rsPayment.MoveNext
        End If
    Loop
    
    If rsOthers.RecordCount <> 0 Then rsOthers.MoveFirst
    Do Until rsOthers.EOF
        If rsOthers.Status = (adRecNew) Or rsOthers.Status = (adRecModified) Then
            If IsNull(rsOthers!cAcctNo) Then
                rsOthers.Delete
            ElseIf Trim(rsOthers!cAcctNo) = "" Then
                rsOthers.Delete
            Else
                rsOthers.MoveNext
            End If
        Else
            rsOthers.MoveNext
        End If
    Loop
    
    If rsAsset.RecordCount <> 0 Then rsAsset.MoveFirst
    Do Until rsAsset.EOF
        If rsAsset.Status = (adRecNew) Or rsAsset.Status = (adRecModified) Then
            If IsNull(rsAsset!cAssetNo) Then
                rsAsset.Delete
            ElseIf Trim(rsAsset!cAssetNo) = "" Then
                rsAsset.Delete
            Else
                rsAsset.MoveNext
            End If
        Else
            rsAsset.MoveNext
        End If
    Loop
    
    GetChild


    If rsAsset.RecordCount <> 0 Then
        rsAsset.MoveFirst
        Do Until rsAsset.EOF
            rsAsset!nIdentity = rsAsset.AbsolutePosition
            rsAsset.MoveNext
        Loop
    End If
    
    
    If rsOthers.RecordCount <> 0 Then
        rsOthers.MoveFirst
        Do Until rsOthers.EOF
            rsOthers!nIdentity = rsOthers.AbsolutePosition
            rsOthers.MoveNext
        Loop
    End If
    
    If rsPayment.RecordCount <> 0 Then
        rsPayment.MoveFirst
        Do Until rsPayment.EOF
            rsPayment!nIdentity = rsPayment.AbsolutePosition
            rsPayment.MoveNext
        Loop
    End If
    
    GetChild
End Function


Private Sub GetChild()
    rsPayment.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
    rsOthers.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
    rsAsset.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
End Sub

Private Function GetSearchString() As String
On Error GoTo ErrorHandler
Dim sWhere As String

    GetSearchString = True

    If Trim$(txtTranNo.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cTranNo LIKE '" & Trim$(txtTranNo.Text) & "%'"
    End If

    If Trim$(dtbDate.Text) <> "__/__/____" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " dDate = '" & Trim$(dtbDate.Text) & "'"
    End If
    
    If Trim$(txtReceived.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cReceived LIKE '" & Trim$(txtReceived.Text) & "%'"
    End If
    
    GetSearchString = Trim$(sWhere)

    Exit Function
ErrorHandler:
    GetSearchString = "ERROR"
End Function

Private Sub RSZero()
    sbRS.Panels(1) = "Record: 0/0"
    sbRS.Panels(2) = ""
    sbRS.Panels(4) = ""
    sbRS.Panels(5) = ""
    
    Set dtgPayment.DataSource = Nothing
    Set dtgOthers.DataSource = Nothing
    Set dtgAsset.DataSource = Nothing
    dtgPayment.Refresh
    dtgOthers.Refresh
    dtgAsset.Refresh
    
    Set FrmName = Me
    UnbindControls
    TextClearing
    FormLocking True
    
    If rsHeader.State = adStateOpen Then rsHeader.Close
    If rsPayment.State = adStateOpen Then rsPayment.Close
    If rsOthers.State = adStateOpen Then rsOthers.Close
    If rsAsset.State = adStateOpen Then rsAsset.Close
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    
    txtTranNo.Locked = False
    txtTranNo.SetFocus
    
    Mode = Find
End Sub

Sub SearchObj(lEnable As Boolean)
    dtbDate.Enabled = lEnable
    cmdPickProject.Enabled = lEnable
    cmdPickWork.Enabled = lEnable
End Sub

Sub TotalPaymentAmount()
Dim n, nPDC, nCash As Double
    
On Error Resume Next
    
    If Mode <> AddNewEdit Then Exit Sub
    
    n = 0
    nPDC = 0
    nCash = 0
    
    Set rs = New Recordset
    Set rs = rsPayment.Clone
    rs.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"

    rs.MoveFirst
    Do Until rs.EOF
        If UCase(Trim(rs!cType)) = "CHK" Then
            nPDC = nPDC + IIf(IsNull(rs!nAmount), 0, rs!nAmount)
        Else
            nCash = nCash + IIf(IsNull(rs!nAmount), 0, rs!nAmount)
        End If
        
        n = n + IIf(IsNull(rs!nAmount), 0, rs!nAmount)
        rs.MoveNext
    Loop
    Set rs = Nothing
    
    rsHeader!nCheck = nPDC
    rsHeader!nCash = nCash
    
End Sub

'Compute amount (others)
Sub TotalOthersAmount()
Dim n, nDebit, nCredit, nAsset As Double
    
On Error Resume Next
    
    If Mode <> AddNewEdit Then Exit Sub
    
    n = 0
    nDebit = 0
    nCredit = 0
    nAsset = 0
    Set rs = New Recordset
    Set rs = rsOthers.Clone
    rs.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"

    rs.MoveFirst
    Do Until rs.EOF
        If UCase(Trim(rs!cType)) = "DEBIT" Then
            nDebit = nDebit + IIf(IsNull(rs!nAmount), 0, rs!nAmount)
        ElseIf UCase(Trim(rs!cType)) = "CREDIT" Then
            nCredit = nCredit + IIf(IsNull(rs!nAmount), 0, rs!nAmount)
        End If
        rs.MoveNext
    Loop
    rs.Close
    
    Set rs = rsAsset.Clone
    rs.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"

    rs.MoveFirst
    Do Until rs.EOF
        nAsset = nAsset + IIf(IsNull(rs!nBook), 0, rs!nBook)
        rs.MoveNext
    Loop
    Set rs = Nothing
    
    rsHeader!nCredit = nCredit + nAsset
    rsHeader!nDebit = nDebit
    
End Sub

Sub TotalAmount()
Dim n1, n2, n3, n4 As Double
    n1 = IIf(IsNull(rsHeader!nDebit), 0, rsHeader!nDebit)
    n2 = IIf(IsNull(rsHeader!nCheck), 0, rsHeader!nCheck)
    n3 = IIf(IsNull(rsHeader!nCash), 0, rsHeader!nCash)
    n4 = IIf(IsNull(rsHeader!nCredit), 0, rsHeader!nCredit)
    txtTotalDebit = n1 + n2 + n3
End Sub

Function CheckExisting(CheckNo As String, Bank As String, TranNo As String, _
            rsExist As ADODB.Recordset, Optional FromDB As Boolean) As Boolean

Dim rsClone As New ADODB.Recordset

    CheckExisting = False
    
    If FromDB Then
        sSQL = "SELECT cCheckNo FROM CHECKS WHERE cCheckNo = '" & CheckNo & "' AND cBankID = '" & Bank & "' AND cCompanyID = '" & COID & "'"
        Set rs = New Recordset
        rs.Open sSQL, cn, adOpenForwardOnly, adLockReadOnly
        
        If rs.RecordCount <> 0 Then
            CheckExisting = True
            Set rs = Nothing
            Exit Function
        End If
        Set rs = Nothing
    End If
    
    Set rsClone = rsExist.Clone
    
    rsClone.Filter = "cCheckNo = '" & CheckNo & "' AND cBank = '" & Bank & "' AND cTranNo = '" & TranNo & "'"
    
    If FromDB Then
        If rsClone.RecordCount > 1 Then
            CheckExisting = True
        End If
    Else
        If rsClone.RecordCount >= 1 Then
            CheckExisting = True
        End If
    End If
    
    Set rsClone = Nothing
    
End Function
   

Sub AddToChecksTable()
Dim cmdToChecks As ADODB.Command
    
    Set cmdToChecks = New ADODB.Command
    With cmdToChecks
        .ActiveConnection = cn
        .CommandTimeout = 1000
        .CommandText = "SP_InsertChecksFromAcknowledgementReceipt"
        .CommandType = adCmdStoredProc
        .Parameters("@cCompanyID") = COID
        .Parameters("@cTranNo") = Trim(txtTranNo)
        .Execute
    End With
    Set cmdToChecks = Nothing

End Sub

Public Sub ShowForm(sTranNo As String)
    If Mode = Find Then

    OpenNewConnection connAsset
    OpenNewConnection connOthers
    OpenNewConnection connPayment
    OpenNewConnection connHeader

    Set rsHeader = Nothing
    Set rsPayment = Nothing
    Set rsOthers = Nothing
    Set rsAsset = Nothing
    Set rsHeader = New ADODB.Recordset
    Set rsPayment = New ADODB.Recordset
    Set rsOthers = New ADODB.Recordset
    Set rsAsset = New ADODB.Recordset

    OpenRecordsetWithCN rsHeader, "*", "INTAR", connHeader, "WHERE cTranNo = '" & Trim(sTranNo) & "'"
    OpenRecordsetWithCN rsAsset, "*", "INTAR_A", connAsset, "WHERE cTranNo = '" & Trim(sTranNo) & "'"
    OpenRecordsetWithCN rsOthers, "*", "INTAR_T", connOthers, "WHERE cTranNo = '" & Trim(sTranNo) & "'"
    OpenRecordsetWithCN rsPayment, "*", "INTAR_C", connPayment, "WHERE cTranNo = '" & Trim(sTranNo) & "'"

        Set FrmName = Me
        FormLocking True

        If rsHeader.RecordCount = 0 Then
            FormWaitHide
            MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
            RSZero
            FormSearch True
            SearchObj True
            Mode = Find
            Exit Sub
        End If
            SetDataSource
            SetDataField
            txtTranNo.BackColor = &HE0FFFF
            Mode = Normal
            BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True

            'BitEnabled Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True, True

    End If
End Sub

Private Sub txtProject_Change()
    txtProjectName = ""
    txtProjectName = GetValueFrTable("cProjectName", "Project_Maintenance", "cProjectNo = '" & Trim(txtProject) & "'")
End Sub


Private Sub txtProject_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtProject) = "" And Trim(txtProject) <> "" Then cmdPickProject_Click
End Sub

Private Sub cmdPickProject_Click()
    If lPickListActive Then Exit Sub
    sFilterString = Trim(txtProject)
    frmITGPicker.zType = QProject
    frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
    
    frmITGPicker.Show vbModal
    txtProject = frmITGPicker.zCode
    txtProjectName = frmITGPicker.zName
    If Trim(txtProjectName) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub txtWork_Change()
    txtWorkDesc = ""
    If txtProject.Text = "" Then: txtProject.SetFocus: Exit Sub
    txtWorkDesc = GetValueFrTable("description", "Work_Maintenance_File", "workno = '" & Trim(txtWork) & "' ") 'and cProjectNo =  '" & Trim(txtProject) & "'")
End Sub


Private Sub cmdPickWork_Click()
    If lPickListActive Then Exit Sub
'    sFilterString = Trim(txtWork)
    frmITGPicker.zType = QWork
    frmITGPicker.Condition = "where cCompanyID = '" & COID & "' " 'and cProjectNo = '" & Trim(txtProject) & "'"
    
    frmITGPicker.Show vbModal
    txtWork = frmITGPicker.zCode
    txtWorkDesc = frmITGPicker.zName
    If Trim(txtWorkDesc) <> "" Then SendKeys "{Tab}"
End Sub


Private Sub txtWork_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtWork) = "" And Trim(txtWork) <> "" Then cmdPickWork_Click
End Sub
